<?php

namespace app\api\controller;

use app\api\model\User as UserModel;
use app\common\controller\Api;

/**
 * 我的接口
 */
class User extends Api
{
    public function info()
    {
        $user = $this->auth;
        $data['nickname']=$user['nickname'];
        $data['mobile']=$user['mobile'];
        $data['avatar']=$user['avatar'];
        $this->success('',$data);
    }
    public function edit()
    {
        $param = request()->param();
        $user = $this->auth;
        $updata['nickname']=$param['nickname'];
        $updata['mobile']=$param['mobile'];
        $updata['avatar']=$param['avatar'];
        $where['id']=$user->id;
        (new UserModel())->save($updata,$where);
        $this->success('');
    }
}
